package com.xian.test.java.java.stream;


import com.xian.test.java.java.bean.MyPerson;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * java flink 流式读取集合
 */
public class StreamReadCollection {


    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();


        List<MyPerson> persons = Arrays.asList(
                new MyPerson(1, "景甜", new Date()),
                new MyPerson(7, "杨幂", new Date(1234567891234L)),
                new MyPerson(3, "刘亦菲", new Date(1232568891534L)),
                new MyPerson(9, "武松", new Date(1234567891234L)),
                new MyPerson(2, "晁盖", new Date(1234251234234L)),
                new MyPerson(6, "浪子艳青", new Date(1234512391234L)),
                new MyPerson(5, "孔明", new Date(1234123891234L))

        );

        DataStreamSource<MyPerson> personDataStreamSource = env.fromCollection(persons);




        personDataStreamSource.print();




        env.execute();





    }








}
